package com.timeserver.netty.chapter2;

import java.util.concurrent.*;

/**
 * Created by zhaoyong on 16/5/3.
 */
public class ThreadServerHandlerExecutePool {
    private ExecutorService executorService;

    ThreadServerHandlerExecutePool(int maxPoolSize, int queueSize) {
        executorService = new ThreadPoolExecutor(Runtime.getRuntime().availableProcessors(), maxPoolSize, 120L, TimeUnit.SECONDS,
                new LinkedBlockingDeque<Runnable>(queueSize));

    }

    public void execute(Runnable task) {
        executorService.execute(task);
    }
}
